"Reputation Shocks and Strategic Political Responses" REPLICATION PACKAGE
By Ruben Poblete-Cazenave

FILE DESCRIPTION:	REPLICATION PACKAGE README FILE
AUTHOR:			RUBEN POBLETE-CAZENAVE
LAST EDITED ON:		FEBRUARY 22, 2024


***********************************************************************************************************************************************************
*** SOFTWARE REQUIREMENTS ***
All data analyses were carried out using:
Stata version 18.0 (64-bit)
Windows 10 (64-bit x86-64).

*** RUN ***
First, leave all files (do files, dta files, ado file) in the same folder.
Second, create an empty folder named "tables and figures", where all tables and figures will be contained. 
Third, "cleaning_running.do" can run all do files o a subsample of the do file. Additionally, it is possible to run 
       any do file associated with the table or figure that wants to be replicated. do files can be run independently. 
Estimated run time: 2 minutes
Tables are exported in tex format (they can be opened with any program supporting LaTex or just with notepad)
Figures are exported as pdf.
***********************************************************************************************************************************************************

- General files: 

"README file.txt": Lists all files and computing environment necessary for replication.
"Codebook.pdf":  Codebook for all variables in dataset and description of the data and sources.

- do files:

"cleaning_running.do": This do files combines all the following do files. 

"main_estimations.do": Contains the commands to reproduce the following tables and figures:
	table 1: In stata
	figure 1: figure_1.pdf
	table 2: table_2a.tex table_2b.tex table_2c.tex
	table 3: table_3a.tex table_3b.tex table_3c.tex
	table 4: table_4.tex
	table 5: table_5.tex
	table 6: table_6.tex
	table 7: table_7.tex
	table 8: table_8.tex

"Appendix_C.do": Contains the commands to reproduce tables of appendix C.
	table c1: In stata
	table c2: table_c2a.tex table_c2b.tex table_c2c.tex
	table c3: table_c3a.tex table_c3b.tex
	table c4: table_c4a.tex table_c4b.tex
	table c5: table_c5a.tex table_c5b.tex
	table c6: table_c6a.tex table_c6b.tex
	table c7: table_c7.tex
	table c8: table_c8.tex
	table c9: table_c9.tex
	table c10: table_c10.tex
	table c13: table_c13.tex 
	figure c1: figure_c1a.png figure_c1b.png

"analysis_polls.do": Contains the commands to reproduce the following tables
	table c11: table_c11a.tex table_c11b.tex table_c11c.tex
	table c12: table_c12a.tex table_c12b.tex table_c12c.tex
	figure c2: figure_c2.pdf

"analysis_extras.do": Contains the commands to reproduce the following tables
	table c14: table_c14.tex
	table c15: table_c15.tex
	table c16: table_c16.tex
	table c17: table_c17.tex

"Appendix_D.do": Contains the commands to reproduce the following tables and figures:
	table d1: table_d1.tex
	table d2: table_d_total_cand.tex
	table d3: table_d_mean_educ.tex
	table d4: table_d4.tex
	figure d1: figure_d1a.png figure_d1b.png
	table d5: table_d5.tex
	table d6: table_d6.tex
	table d7: table_d7.tex

- Packages that need to be installed for replication:
1. "estout": capture ssc install estout. Code already included in "cleaning_running.do".
2. "balancetable": capture ssc install balancetable. Code already included in "cleaning_running.do".

- dta files:

"data_brasil_camp.dta": Contains electoral data for mayors in Brazil. Unit of observation: Candidate/Municipality level. More details in codebook.
"data_brasil_camp_chall.dta": Contains electoral data for the main challengers running for mayor in Brazil. Unit of observation: candidate/municipality level. More details in codebook. 
"data_polls.dta": Contains data for municipalities with electoral polls. Unit of observation: municipal level. More details in codebook.
"data_others.dta": Contains data for municipalities with lame duck politicians. Unit of observation: municipal level. More details in codebook.

 - log file:

1. cleaning_running.log: This file keeps a log of events when running the "cleaning_running.do".